package com.anlu.base.function.convert;

import com.anlu.base.function.enums.FunEnum;
import com.anlu.base.function.mode.FormComponentBaseBO;
import com.anlu.base.function.mode.po.FormContentPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

public interface FormConvert {



    default FormComponentBaseBO po2bo(FormContentPO po) {
        FormComponentBaseBO bo = new FormComponentBaseBO<>();
        bo.setKey(po.getComponentKey());
        bo.setType(FunEnum.codeOf(po.getComponentType()));
        bo.setTitle(po.getComponentTitle());
        bo.setValue(bo.getType().getFunction().apply(po.getComponentValue()));
        return bo;
    }

}
